home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: bear.wn.bawue.de!jo
- From: jo@bear.wn.bawue.de (Joerg Sommrey)
- Subject: Re: What is the correct behaviour ?
- Message-ID: <Do1uu2.ABM@bear.wn.bawue.de>
- Organization: private
- Date: Sun, 10 Mar 1996 11:34:49 GMT
- References: <1996Mar9.130223.1400@paramount.nikhefk.nikhef.nl>
-
- In <1996Mar9.130223.1400@paramount.nikhefk.nikhef.nl> bouvere@paramount.nikhefk.nikhef.nl (Ferdinand de Bouvere) writes:
-
- >Trying this code on 3 platforms:
-
- [...]
-
- >Linux gcc: OK
- >result: 123
-
- That's strange:
-
- ~/tmp$ cat ctest.c
- #include <stdio.h>
- int a = 0;
- int main(void)
- {
- int a = 123;
- {
- extern int a;
- printf("%d\n", a);
- }
- return 0;
- }
-
- ~/tmp$ make ctest
- gcc -m486 -O2 -Wall -ansi -pedantic ctest.c -o ctest
- ctest.c: In function `main':
- ctest.c:5: warning: unused variable `a'
-
- ~/tmp$ ./ctest
- 0
-
- ~/tmp$ gcc --version
- 2.5.8
-
- This is - as already stated - the correct result.
-
- -Jo
- --
- -rw-r--r-- 1 jo users 75 Mar 10 11:06 /home/jo/.signature
-